<template>
	<view class="frist" @click="bindClick">
		<image :src="localurl+datalist.picture" mode="widthFix"></image>
		<view :class="['newtitle','fontsize'+fontsizenub]">{{datalist.title}}</view>
	</view>
</template>

<script>
	import {common} from '@/common/publish.js';
	import {mapState,mapMutations} from 'vuex';
	export default {
		props:{
			datalist:{
				type:Object
			}
		},
		data() {
			return {
				localurl:common.url
			};
		},
		computed:{
			...mapState(['fontsizenub'])
		},
		methods:{
			bindClick(){
				var that = this;
				uni.request({
					url:common.url+'/api/Frontiers/firstList.json',
					data:{
						relationid:this.datalist.id
					},
					success:(res)=>{
						// console.log(res)
						if(res.statusCode == 200){
							if(res.data.total == 1){
								var threeid = res.data.rows[0].id;
								var threetitle = res.data.rows[0].title;
								uni.request({
									url:common.url+'/api/Frontiers/secondList.json',
									data:{
										relationid:threeid
									},
									success:function(res){
										that.$emit('TurnThree',threeid,threetitle)
									}
								})
							
								
							}else{
								// console.log('222')
								this.$emit('TurnTwo',this.datalist.id,this.datalist.picture,this.datalist.title)
							}
						}
					}
				})
				//
			}
		}
	}
</script>

<style lang="scss">
	@import '@/common/publish.scss';
	@include fontsizefn(".zbtt",32upx);
	@include fontsizefn(".newtitle",32upx);
	@include fontsizefn(".nubdata",26upx);
	.frist{
		width: 100%;
		margin-bottom: 20upx;
		background: #efeff4;
		view{
			padding: 30upx 28upx;
			line-height:40upx;
		}
	}
	image{
		width: 100%;
	}
	
</style>
